package top.tenebrous.termbor.rpc.consumer.initializer;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import top.tenebrous.termbor.rpc.consumer.handler.RpcConsumerHandler;
import top.tenebrous.termbor.rpc.serialization.codec.RpcDecoder;
import top.tenebrous.termbor.rpc.serialization.codec.RpcEncoder;

/**
 * @program: termbor-rpc
 * @description:
 * @author: yazhang6
 * @create: 2024-05-22 11:13
 **/
public class RpcConsumerInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        socketChannel.pipeline()
            .addLast(new RpcEncoder())
            .addLast(new RpcDecoder())
            .addLast(new RpcConsumerHandler());
    }

}
